/*
 * @Author: liuYang codkly@gmail.com
 * @Date: 2022-12-05 17:23:28
 * @LastEditors: liuYang codkly@gmail.com
 * @LastEditTime: 2022-12-06 16:25:42
 * @FilePath: \coding\nest\blog_alpha\src\userinfo\userinfo.entity.ts
 * @Description:
 * 暂无备注
 */
import {
  Column,
  CreateDateColumn,
  DeleteDateColumn,
  Entity,
  ManyToMany,
  OneToMany,
  PrimaryGeneratedColumn,
  JoinTable
} from 'typeorm';
import { BaseEntity } from '../../entity/base.entity';
import { RoleEntity } from '../role/role.entity';

@Entity('userinfo')
export class UserinfoEntity extends BaseEntity {

  // @Column('simple-array', {
  //   nullable: true,
  //   comment: '角色',
  // })
  // @ManyToMany(() => RoleEntity) //单向绑定
  @ManyToMany(() => RoleEntity, role => role.users) //双向绑定
  @JoinTable()
  roles: RoleEntity[];

  @Column({
    comment: '发布文章条数',
  })
  count: Number;

  @Column({
    nullable: true,
    comment: '头像',
  })
  avatar: string;

  @Column('simple-array', {
    nullable: true,
    comment: '标签',
  })
  tag: string[];

  @Column('mediumtext', {
    nullable: true,
    comment: '介绍',
  })
  intro: string;
}
